#ifndef __PARAMETER_H
#define __PARAMETER_H


// Special type of the variables
typedef enum {WRONG = 0, CORRECT = !WRONG} PacketStatus;
typedef enum {OFF = 0, ON = !OFF} WorkStatus;
typedef enum {EMPTY = 0, NONEMPTY, FULL} CapacityStatus;
typedef enum {UPPER_BODY = 0, RIGHT_LEG, LEFT_LEG, BODYPART_NUM} BodyPartStatus;
typedef enum {NONE = 0, START = 1, ACT = 2, END = 3} MotionStateStatus;
typedef enum {LOW = 0, HIGH = !LOW} LevelStatus;
typedef enum {X = 0, Y = 1, Z = 2, AXIS_NUM} AxisStatus;

////////////////////////////////////////////////////////////////
//#define ADULT
#define TEEN
//#define KID
////////////////////////////////////////////////////////////////

#define BAUDRATE											TYbCommDevice::br115200
#define TIMERINTERVAL_WRITEMOTOR			100
#define TIMERINTERVAL_READMOTOR				10

// Motor
#define ID_BASE							 					0
#define TORQUE_BASE		 								50

#if defined ADULT
	// For Adult(David II & David III)
	#define MOTOR_NUM_UB										15
	#define MOTOR_NUM_RL				 						6
	#define MOTOR_NUM_LL				 						6
	#define MOTOR_NUM			 									(MOTOR_NUM_UB+MOTOR_NUM_RL+MOTOR_NUM_LL)
	#define MOTOR_MAX_ID                  	45
	#define READ_ID_INDEX_OTHER_LOWERBOUND	5
#elif defined TEEN
	// For Teen 2014
	#define MOTOR_NUM_UB										27
	#define MOTOR_NUM_RL				 						1
	#define MOTOR_NUM_LL				 						1
	#define MOTOR_NUM			 									(MOTOR_NUM_UB+MOTOR_NUM_RL+MOTOR_NUM_LL)
	#define MOTOR_MAX_ID                  	45
	#define READ_ID_INDEX_OTHER_LOWERBOUND	5
#elif defined KID
	// For Kid 2014
	#define MOTOR_NUM_UB										10
	#define MOTOR_NUM_RL				 						15
	#define MOTOR_NUM_LL				 						1
	#define MOTOR_NUM			 									(MOTOR_NUM_UB+MOTOR_NUM_RL+MOTOR_NUM_LL)
	#define MOTOR_MAX_ID                  	25
	#define READ_ID_INDEX_OTHER_LOWERBOUND	3
#else
	ShowMessage("Robot type undefined!!");
#endif


#define IMU_DATA_NUM                  9        //9 axis
#define FSR_NUM												10

#define MOTOR_READ_TOTAL_NUM          (MOTOR_NUM + IMU_DATA_NUM + FSR_NUM)

#define MOTOR_SCHEDULE_SIZE 					32768
#define MOTOR_SCHEDULE_LIST_LENGTH		5
#define HEAD_SCHEDULE_SIZE 					 	64
#define HEAD_SCHEDULE_LIST_LENGTH			5

#define MOTOR_RX_BUFF_SIZE						128

#define MAX_MOTOR_POSITION						4095
#define MAX_MOTOR_VELOCITY						1023

#define MOTION_QUEUE_SIZE							128

#define HAED_SEARACH_SPEED_L					0 
#define HAED_SEARACH_SPEED_H					1

// Port Buffer
#define COMP_RX_BUFF_SIZE			128
#define BOARD_RX_BUFF_SIZE		128
#define HMI_RX_BUFF_SIZE			128
													
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

#endif /* __PARAMETER_H */
